import request from '@/utils/request/index'

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/service/main/capabi/v1/login/valid/genPic.do',
    method: 'get',
    responseType: 'blob',
  })
}

// 校验验证码
export function verifyCode(code: string) {
  return request({
    url: `/service/main/capabi/v1/login/valid/verifyPic.do?code=${code}`,
    method: 'post',
  })
}

// 获取加密密钥
export function getKey() {
  return request({
    url: `/service/main/capabi/v1/login/public_key`,
    method: 'get',
  })
}

// 校验验证码
export function login(data: Object) {
  return request({
    url: `/service/main/capabi/v1/login/do`,
    method: 'post',
    data,
  })
}
// 退出登录
export function logout() {
  return request({
    url: `/service/main/capabi/v1/login/logout`,
    method: 'post',
  })
}
// 注册
export function register(data: Object) {
  return request({
    url: `/service/main/portal/register/do`,
    method: 'post',
    data,
  })
}

// 获取用户信息
export function getUserInfo() {
  return request({
    url: `/service/main/portal/info`,
    method: 'get',
  })
}

export function getDeveloperOverview() {
  return request({
    url: `/service/system/portal/developerApply/v1/developerOverview`,
    method: 'get',
  })
}

// 购物车列表
export function cartList(data: any) {
  return request({
    url: `/service/settlement/cart/list`,
    method: 'post',
    data,
  })
}

// 获取能力聚合平台token
export function getOpenToken(code) {
  return request({
    url: `/open/core/getToken?userId=${code}`,
    method: 'get',
  })
}

export function getDescString() {
  return request({
    url: `/service/main/capabi/v1/login/getDescString`,
    method: 'get',
  })
}
